import Vue from 'vue'
import Router from 'vue-router'
//路由配置
import main from '@/pages/main'//首页

Vue.use(Router)
const router = new Router({
  mode:'history',
  routes: [
  {
      path: '/main',
      name: 'main',
      meta: {
        title: '首页'
      },
      component: main
    },
  ]
})
router.beforeEach((to, from, next) => {
  if (to.meta.title) {//如果设置标题，拦截后设置标题
    document.title = to.meta.title
  }
  next()
})
export default router